namespace SimpleWebServices.Web
{
    using System;
    using System.Web;
    using Moq;
    using SimpleWebServices;
    using Xunit;

    public sealed class WwwAuthenticateCookieFacts
    {
        [Fact]
        public void typedef()
        {
            Assert.True(new ObjectExpectations<WwwAuthenticateCookie>()
                .DerivesFrom<object>()
                .IsConcreteClass()
                .IsSealed()
                .HasDefaultConstructor()
                .Implements<IWwwAuthenticate>()
                .Result);
        }

        [Fact]
        public void ctor()
        {
            Assert.NotNull(new WwwAuthenticateCookie());
        }

        [Fact]
        public void Challenge_HttpContextBase()
        {
            var mock = new Mock<HttpContextBase>();

            Assert.Equal<string>("Cookie", new WwwAuthenticateCookie().Challenge(mock.Object));
        }

        [Fact]
        public void Challenge_HttpContextBaseNull()
        {
            Assert.Throws<ArgumentNullException>(() => new WwwAuthenticateCookie().Challenge(null as HttpContextBase));
        }
    }
}